package com.ygo.feihua.fragment;
import android.support.v4.app.*;
import android.view.*;
import android.os.*;
import com.ygo.feihua.*;
import android.support.v7.widget.*;
import java.util.*;
import com.ygo.feihua.adapter.*;

public class FragmentFtGaoji extends Fragment
{

	private RecyclerView gj_rec;

	private ArrayList<FatieMessage> data;

	private AdapterFt adpft;

	public void setMessage(List<FatieMessage> da)
	{
		data.clear();
		for(FatieMessage fm: da){
			data.add(fm);
		}
		adpft.sx();
		// TODO: Implement this method
	}

	public void getMessage()
	{
		ShequFabu sf=(ShequFabu)getActivity();
		sf.closeMessage();
		for(FatieMessage fm: data){
			sf.addMessage(fm);
		}
		// TODO: Implement this method
	}

	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
	{
		View v=inflater.inflate(R.layout.fragment_ft_gaoji,null);
		
		initView(v);
		
		return v;
		// TODO: Implement this method
		
	}

	private void initView(View v)
	{
		gj_rec=(RecyclerView) v.findViewById(R.id.gj_rec);
		
		LinearLayoutManager llm=new LinearLayoutManager(getActivity());

		gj_rec.setLayoutManager(llm);

		data=new ArrayList<FatieMessage>();
		FatieMessage ftm=new FatieMessage();
		ftm.setImage_path("");
		ftm.setMessage("");
		data.add(ftm);

		adpft=new AdapterFt(getActivity(),data);
		gj_rec.setAdapter(adpft);
		// TODO: Implement this method
	}
	
	public void setImage(ArrayList<String> photos){
		data.get(adpft.getImagePosition()).setImage_path(photos.get(0));
		adpft.sx();
	}
	
}
